<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <title>礼物愿望 - 心愿社交</title>
    <!-- Bootstrap 5 CSS -->
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
    <!-- Font Awesome 图标 -->
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css">
    
    <style>
        :root {
            --primary: #8b5cf6; /* 主色调：紫色，代表梦想和希望 */
            --primary-light: #c4b5fd;
            --primary-dark: #6d28d9;
            --secondary: #ec4899; /* 辅助色：粉色，代表浪漫 */
            --accent: #f59e0b; /* 强调色：橙色，代表活力 */
            --success: #10b981; /* 成功色：绿色 */
            --danger: #ef4444; /* 危险色：红色 */
            --text-primary: #1f2937;
            --text-secondary: #6b7280;
            --text-light: #9ca3af;
            --bg-light: #f9fafb;
            --bg-white: #ffffff;
            --border-light: #e5e7eb;
            --radius: 12px;
            --shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
        }
        
        body {
            font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
            background-color: var(--bg-light);
            color: var(--text-primary);
            padding-top: 55px;
            padding-bottom: 75px;
        }
        
        /* 顶部导航 */
        .top-nav {
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            height: 55px;
            background-color: var(--bg-white);
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 0 15px;
            z-index: 1000;
            border-bottom: 1px solid var(--border-light);
            box-shadow: var(--shadow);
        }
        
        .nav-title {
            font-size: 1.15rem;
            font-weight: 600;
            color: var(--primary-dark);
        }
        
        .nav-action {
            color: var(--text-secondary);
            background: none;
            border: none;
            font-size: 1.2rem;
            width: 40px;
            height: 40px;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
        }
        
        .nav-action:hover {
            background-color: var(--bg-light);
        }
        
        /* 搜索栏 */
        .search-container {
            padding: 12px 15px;
            background-color: var(--bg-white);
            border-bottom: 1px solid var(--border-light);
        }
        
        .search-box {
            position: relative;
        }
        
        .search-input {
            width: 100%;
            padding: 10px 15px 10px 40px;
            border-radius: 30px;
            border: 1px solid var(--border-light);
            background-color: var(--bg-light);
            font-size: 0.9rem;
        }
        
        .search-input:focus {
            outline: none;
            border-color: var(--primary-light);
            box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.1);
        }
        
        .search-icon {
            position: absolute;
            left: 15px;
            top: 12px;
            color: var(--text-secondary);
        }
        
        /* 分类标签 */
        .category-tabs {
            display: flex;
            padding: 0 15px;
            background-color: var(--bg-white);
            overflow-x: auto;
            scrollbar-width: none;
            border-bottom: 1px solid var(--border-light);
        }
        
        .category-tabs::-webkit-scrollbar {
            display: none;
        }
        
        .category-tab {
            flex: 0 0 auto;
            padding: 12px 18px;
            font-size: 0.9rem;
            font-weight: 500;
            color: var(--text-secondary);
            background: none;
            border: none;
            border-bottom: 2px solid transparent;
            margin-right: 5px;
        }
        
        .category-tab.active {
            color: var(--primary);
            border-bottom-color: var(--primary);
        }
        
        /* 筛选栏 */
        .filter-bar {
            display: flex;
            padding: 10px 15px;
            background-color: var(--bg-white);
            border-bottom: 1px solid var(--border-light);
            justify-content: space-between;
        }
        
        .filter-label {
            font-size: 0.85rem;
            color: var(--text-secondary);
            display: flex;
            align-items: center;
            gap: 5px;
        }
        
        .filter-select {
            font-size: 0.85rem;
            color: var(--text-primary);
            background: none;
            border: none;
            padding: 5px 0;
            border-bottom: 1px dashed var(--border-light);
        }
        
        /* 礼物愿望列表 */
        .gift-list {
            padding: 10px 15px;
        }
        
        /* 礼物卡片样式 - 通用 */
        .gift-card {
            background-color: var(--bg-white);
            border-radius: var(--radius);
            margin-bottom: 15px;
            overflow: hidden;
            box-shadow: var(--shadow);
            transition: transform 0.2s ease;
        }
        
        .gift-card:hover {
            transform: translateY(-2px);
        }
        
        .gift-header {
            padding: 12px 15px;
            display: flex;
            align-items: center;
            gap: 10px;
            border-bottom: 1px solid var(--border-light);
        }
        
        .gift-avatar {
            width: 40px;
            height: 40px;
            border-radius: 50%;
            object-fit: cover;
        }
        
        .gift-user {
            flex: 1;
        }
        
        .user-name {
            font-size: 0.95rem;
            font-weight: 500;
            margin-bottom: 2px;
        }
        
        .gift-time {
            font-size: 0.75rem;
            color: var(--text-secondary);
        }
        
        .gift-content {
            padding: 15px;
        }
        
        .gift-title {
            font-size: 1.1rem;
            font-weight: 600;
            margin-bottom: 8px;
            color: var(--primary-dark);
            line-height: 1.4;
        }
        
        .gift-description {
            font-size: 0.9rem;
            line-height: 1.5;
            margin-bottom: 12px;
            color: var(--text-primary);
        }
        
        /* 价格信息 */
        .gift-price {
            color: var(--danger);
            font-weight: 600;
            margin-bottom: 10px;
            font-size: 0.95rem;
            display: flex;
            align-items: center;
            gap: 5px;
        }
        
        .price-range {
            color: var(--text-secondary);
            font-weight: normal;
            font-size: 0.85rem;
        }
        
        /* 图片容器样式 */
        .gift-media {
            margin-bottom: 12px;
            border-radius: 8px;
            overflow: hidden;
        }
        
        .no-media {
            display: none;
        }
        
        .single-media {
            width: 100%;
            border-radius: 8px;
            overflow: hidden;
        }
        
        .single-media img {
            width: 100%;
            height: 200px;
            object-fit: cover;
        }
        
        .multi-media {
            display: grid;
            grid-template-columns: repeat(3, 1fr);
            gap: 3px;
            border-radius: 8px;
            overflow: hidden;
        }
        
        .media-item {
            aspect-ratio: 1/1;
            overflow: hidden;
        }
        
        .media-item img {
            width: 100%;
            height: 100%;
            object-fit: cover;
        }
        
        /* 礼物标签和状态 */
        .gift-meta {
            display: flex;
            flex-wrap: wrap;
            gap: 8px;
            margin-bottom: 12px;
        }
        
        .gift-tag {
            background-color: rgba(139, 92, 246, 0.1);
            color: var(--primary);
            font-size: 0.8rem;
            padding: 3px 10px;
            border-radius: 12px;
        }
        
        .gift-status {
            font-size: 0.8rem;
            padding: 3px 10px;
            border-radius: 12px;
            font-weight: 500;
        }
        
        .status-wishing {
            background-color: rgba(245, 158, 11, 0.1);
            color: var(--accent);
        }
        
        .status-received {
            background-color: rgba(16, 185, 129, 0.1);
            color: var(--success);
        }
        
        /* 互动区域 */
        .gift-actions {
            display: flex;
            justify-content: space-around;
            padding: 8px 0;
            border-top: 1px solid var(--border-light);
        }
        
        .action-btn {
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            padding: 5px 0;
            background: none;
            border: none;
            color: var(--text-secondary);
            font-size: 0.75rem;
            width: 100%;
            gap: 3px;
        }
        
        .action-btn i {
            font-size: 1rem;
        }
        
        .action-btn:hover, .action-btn.active {
            color: var(--primary);
        }
        
        .action-count {
            font-size: 0.7rem;
        }
        
        /* 特殊卡片样式 */
        .featured-card {
            border: 1px solid var(--primary-light);
            position: relative;
        }
        
        .featured-badge {
            position: absolute;
            top: 10px;
            right: 10px;
            background-color: var(--secondary);
            color: white;
            font-size: 0.7rem;
            padding: 2px 8px;
            border-radius: 10px;
        }
        
        /* 底部悬浮按钮 */
        .add-gift-btn {
            position: fixed;
            right: 20px;
            bottom: 85px;
            width: 56px;
            height: 56px;
            border-radius: 50%;
            background-color: var(--primary);
            color: white;
            border: none;
            box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 1.5rem;
            z-index: 900;
        }
        
        .add-gift-btn:hover {
            background-color: var(--primary-dark);
        }
        
        /* 底部导航 */
        .bottom-nav {
            position: fixed;
            bottom: 0;
            left: 0;
            right: 0;
            height: 65px;
            background-color: var(--bg-white);
            display: flex;
            justify-content: space-around;
            align-items: center;
            border-top: 1px solid var(--border-light);
            z-index: 1000;
        }
        
        .nav-item {
            display: flex;
            flex-direction: column;
            align-items: center;
            color: var(--text-secondary);
            font-size: 0.7rem;
            text-decoration: none;
        }
        
        .nav-item i {
            font-size: 1.3rem;
            margin-bottom: 3px;
        }
        
        .nav-item.active {
            color: var(--primary);
        }
        
        /* 提示消息 */
        .toast-notification {
            position: fixed;
            bottom: 80px;
            left: 50%;
            transform: translateX(-50%);
            background-color: rgba(0, 0, 0, 0.7);
            color: white;
            padding: 8px 16px;
            border-radius: 4px;
            z-index: 9999;
            font-size: 0.9rem;
            opacity: 0;
            transition: opacity 0.3s ease;
        }
        
        .toast-notification.show {
            opacity: 1;
        }
        
        /* 加载更多 */
        .load-more {
            width: 100%;
            padding: 12px;
            margin: 10px 0 20px;
            background-color: var(--bg-white);
            border: 1px solid var(--border-light);
            border-radius: var(--radius);
            color: var(--text-secondary);
            font-size: 0.9rem;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 8px;
        }
    </style>
</head>
<body>
    <!-- 顶部导航 -->
    <div class="top-nav">
        <button class="nav-action" id="backBtn">
            <i class="fas fa-arrow-left"></i>
        </button>
        <div class="nav-title">礼物愿望</div>
        <button class="nav-action" id="filterBtn">
            <i class="fas fa-filter"></i>
        </button>
    </div>
    
    <!-- 搜索栏 -->
    <div class="search-container">
        <div class="search-box">
            <i class="fas fa-search search-icon"></i>
            <input type="text" class="search-input" placeholder="搜索礼物愿望、标签或用户...">
        </div>
    </div>
    
    <!-- 分类标签 -->
    <div class="category-tabs">
        <button class="category-tab active">全部礼物</button>
        <button class="category-tab">电子产品</button>
        <button class="category-tab">美妆护肤</button>
        <button class="category-tab">书籍文具</button>
        <button class="category-tab">服装配饰</button>
        <button class="category-tab">家居用品</button>
        <button class="category-tab">已收到</button>
    </div>
    
    <!-- 筛选栏 -->
    <div class="filter-bar">
        <div class="filter-label">
            <i class="fas fa-sort"></i>
            <select class="filter-select" id="sortSelect">
                <option value="newest">最新发布</option>
                <option value="popular">热门优先</option>
                <option value="price-low">价格从低到高</option>
                <option value="price-high">价格从高到低</option>
            </select>
        </div>
        <div class="filter-label">
            <i class="fas fa-tag"></i>
            <select class="filter-select" id="priceSelect">
                <option value="all">全部价格</option>
                <option value="0-100">¥0-100</option>
                <option value="100-300">¥100-300</option>
                <option value="300-500">¥300-500</option>
                <option value="500+">¥500以上</option>
            </select>
        </div>
    </div>
    
    <!-- 礼物愿望列表 -->
    <div class="gift-list" id="giftList">
        <!-- 多图礼物卡片 -->
        <div class="gift-card">
            <div class="gift-header">
                <img src="https://picsum.photos/id/64/100/100" alt="用户头像" class="gift-avatar">
                <div class="gift-user">
                    <div class="user-name">数码爱好者</div>
                    <div class="gift-time">1小时前</div>
                </div>
            </div>
            
            <div class="gift-content">
                <h3 class="gift-title">想要一套专业摄影器材套装</h3>
                <p class="gift-description">
                    最近迷上了摄影，希望能拥有一套入门级的单反相机套装，包含标准镜头和三脚架。主要用于旅行拍摄和日常记录，预算在5000元左右。
                </p>
                
                <div class="gift-price">
                    <i class="fas fa-rmb"></i>
                    <span>预算: 5000元左右</span>
                </div>
                
                <div class="gift-media multi-media">
                    <div class="media-item">
                        <img src="https://picsum.photos/id/119/300/300" alt="相机1">
                    </div>
                    <div class="media-item">
                        <img src="https://picsum.photos/id/160/300/300" alt="相机2">
                    </div>
                    <div class="media-item">
                        <img src="https://picsum.photos/id/180/300/300" alt="三脚架">
                    </div>
                </div>
                
                <div class="gift-meta">
                    <span class="gift-tag">电子产品</span>
                    <span class="gift-tag">摄影</span>
                    <span class="gift-status status-wishing">许愿中</span>
                </div>
            </div>
            
            <div class="gift-actions">
                <button class="action-btn like-btn">
                    <i class="far fa-heart"></i>
                    <span class="action-count">32</span>
                </button>
                <button class="action-btn comment-btn">
                    <i class="far fa-comment"></i>
                    <span class="action-count">8</span>
                </button>
                <button class="action-btn share-btn">
                    <i class="far fa-share-alt"></i>
                    <span>分享</span>
                </button>
                <button class="action-btn save-btn">
                    <i class="far fa-bookmark"></i>
                    <span>收藏</span>
                </button>
            </div>
        </div>
        
        <!-- 单图礼物卡片 -->
        <div class="gift-card featured-card">
            <div class="featured-badge">热门愿望</div>
            <div class="gift-header">
                <img src="https://picsum.photos/id/26/100/100" alt="用户头像" class="gift-avatar">
                <div class="gift-user">
                    <div class="user-name">美妆达人</div>
                    <div class="gift-time">3小时前</div>
                </div>
            </div>
            
            <div class="gift-content">
                <h3 class="gift-title">想要那套限量版彩妆礼盒</h3>
                <p class="gift-description">
                    看中了那款新出的限量版彩妆礼盒，里面包含眼影盘、口红和腮红，颜色特别适合秋冬季节。希望生日能收到这份礼物，据说很难买到！
                </p>
                
                <div class="gift-price">
                    <i class="fas fa-rmb"></i>
                    <span>参考价格: 899元</span>
                </div>
                
                <div class="gift-media single-media">
                    <img src="https://picsum.photos/id/96/800/400" alt="彩妆礼盒">
                </div>
                
                <div class="gift-meta">
                    <span class="gift-tag">美妆护肤</span>
                    <span class="gift-tag">限量版</span>
                    <span class="gift-status status-wishing">许愿中</span>
                </div>
            </div>
            
            <div class="gift-actions">
                <button class="action-btn like-btn active">
                    <i class="fas fa-heart"></i>
                    <span class="action-count">128</span>
                </button>
                <button class="action-btn comment-btn">
                    <i class="far fa-comment"></i>
                    <span class="action-count">42</span>
                </button>
                <button class="action-btn share-btn">
                    <i class="far fa-share-alt"></i>
                    <span>分享</span>
                </button>
                <button class="action-btn save-btn">
                    <i class="far fa-bookmark"></i>
                    <span>收藏</span>
                </button>
            </div>
        </div>
        
        <!-- 无图礼物卡片 -->
        <div class="gift-card">
            <div class="gift-header">
                <img src="https://picsum.photos/id/91/100/100" alt="用户头像" class="gift-avatar">
                <div class="gift-user">
                    <div class="user-name">书虫一枚</div>
                    <div class="gift-time">昨天</div>
                </div>
            </div>
            
            <div class="gift-content">
                <h3 class="gift-title">想要《三体》全套精装版</h3>
                <p class="gift-description">
                    一直想收藏一套《三体》三部曲的精装版，刘慈欣的科幻作品真的太吸引人了！希望能收到这个礼物，放在书架上一定很美观。
                </p>
                
                <div class="gift-price">
                    <i class="fas fa-rmb"></i>
                    <span>参考价格: 198元</span>
                </div>
                
                <div class="gift-media no-media"></div>
                
                <div class="gift-meta">
                    <span class="gift-tag">书籍文具</span>
                    <span class="gift-tag">科幻</span>
                    <span class="gift-status status-wishing">许愿中</span>
                </div>
            </div>
            
            <div class="gift-actions">
                <button class="action-btn like-btn">
                    <i class="far fa-heart"></i>
                    <span class="action-count">56</span>
                </button>
                <button class="action-btn comment-btn">
                    <i class="far fa-comment"></i>
                    <span class="action-count">15</span>
                </button>
                <button class="action-btn share-btn">
                    <i class="far fa-share-alt"></i>
                    <span>分享</span>
                </button>
                <button class="action-btn save-btn">
                    <i class="far fa-bookmark"></i>
                    <span>收藏</span>
                </button>
            </div>
        </div>
        
        <!-- 已收到的礼物卡片 -->
        <div class="gift-card">
            <div class="gift-header">
                <img src="https://picsum.photos/id/65/100/100" alt="用户头像" class="gift-avatar">
                <div class="gift-user">
                    <div class="user-name">运动达人</div>
                    <div class="gift-time">3天前</div>
                </div>
            </div>
            
            <div class="gift-content">
                <h3 class="gift-title">收到了心仪已久的运动手环</h3>
                <p class="gift-description">
                    生日收到了朋友送的运动手环，太开心了！这款手环可以监测心率、睡眠，还能记录运动数据，正是我需要的。感谢好朋友的心意！
                </p>
                
                <div class="gift-price">
                    <i class="fas fa-rmb"></i>
                    <span>价格: 399元</span>
                    <span class="price-range">(已收到)</span>
                </div>
                
                <div class="gift-media single-media">
                    <img src="https://picsum.photos/id/169/800/400" alt="运动手环">
                </div>
                
                <div class="gift-meta">
                    <span class="gift-tag">电子产品</span>
                    <span class="gift-tag">运动</span>
                    <span class="gift-status status-received">已收到</span>
                </div>
            </div>
            
            <div class="gift-actions">
                <button class="action-btn like-btn">
                    <i class="far fa-heart"></i>
                    <span class="action-count">78</span>
                </button>
                <button class="action-btn comment-btn">
                    <i class="far fa-comment"></i>
                    <span class="action-count">23</span>
                </button>
                <button class="action-btn share-btn">
                    <i class="far fa-share-alt"></i>
                    <span>分享</span>
                </button>
                <button class="action-btn save-btn">
                    <i class="far fa-bookmark"></i>
                    <span>收藏</span>
                </button>
            </div>
        </div>
        
        <!-- 双图礼物卡片 -->
        <div class="gift-card">
            <div class="gift-header">
                <img src="https://picsum.photos/id/22/100/100" alt="用户头像" class="gift-avatar">
                <div class="gift-user">
                    <div class="user-name">时尚博主</div>
                    <div class="gift-time">1周前</div>
                </div>
            </div>
            
            <div class="gift-content">
                <h3 class="gift-title">想要一款复古风格的手表</h3>
                <p class="gift-description">
                    最近很喜欢复古风格的配饰，看中了两款手表，一款是棕色皮带的机械表，另一款是银色金属表带的石英表，价格在1000-1500元之间。
                </p>
                
                <div class="gift-price">
                    <i class="fas fa-rmb"></i>
                    <span>预算: 1000-1500元</span>
                </div>
                
                <div class="gift-media multi-media">
                    <div class="media-item">
                        <img src="https://picsum.photos/id/669/300/300" alt="手表1">
                    </div>
                    <div class="media-item">
                        <img src="https://picsum.photos/id/668/300/300" alt="手表2">
                    </div>
                </div>
                
                <div class="gift-meta">
                    <span class="gift-tag">服装配饰</span>
                    <span class="gift-tag">手表</span>
                    <span class="gift-status status-wishing">许愿中</span>
                </div>
            </div>
            
            <div class="gift-actions">
                <button class="action-btn like-btn">
                    <i class="far fa-heart"></i>
                    <span class="action-count">45</span>
                </button>
                <button class="action-btn comment-btn">
                    <i class="far fa-comment"></i>
                    <span class="action-count">12</span>
                </button>
                <button class="action-btn share-btn">
                    <i class="far fa-share-alt"></i>
                    <span>分享</span>
                </button>
                <button class="action-btn save-btn">
                    <i class="far fa-bookmark"></i>
                    <span>收藏</span>
                </button>
            </div>
        </div>
        
        <!-- 加载更多 -->
        <button class="load-more" id="loadMore">
            <i class="fas fa-spinner fa-spin"></i>
            <span>加载更多礼物愿望</span>
        </button>
    </div>
    
    <!-- 添加礼物愿望按钮 -->
    <button class="add-gift-btn" id="addGiftBtn">
        <i class="fas fa-plus"></i>
    </button>
    
    <!-- 底部导航 -->
    <div class="bottom-nav">
        <a href="#" class="nav-item">
            <i class="fas fa-home"></i>
            <span>首页</span>
        </a>
        <a href="#" class="nav-item">
            <i class="fas fa-star"></i>
            <span>许愿墙</span>
        </a>
        <a href="#" class="nav-item active">
            <i class="fas fa-gift"></i>
            <span>礼物愿望</span>
        </a>
        <a href="#" class="nav-item">
            <i class="far fa-user"></i>
            <span>我的</span>
        </a>
    </div>
    
    <!-- Bootstrap JS Bundle with Popper -->
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
    
    <script>
        // 提示消息
        function showToast(message) {
            // 检查是否已有toast
            let toast = document.querySelector('.toast-notification');
            if (toast) {
                toast.remove();
            }
            
            // 创建新toast
            toast = document.createElement('div');
            toast.className = 'toast-notification';
            toast.textContent = message;
            
            document.body.appendChild(toast);
            
            // 显示toast
            setTimeout(() => {
                toast.classList.add('show');
            }, 10);
            
            // 3秒后隐藏并移除
            setTimeout(() => {
                toast.classList.remove('show');
                setTimeout(() => toast.remove(), 300);
            }, 3000);
        }
        
        // 返回按钮
        document.getElementById('backBtn').addEventListener('click', () => {
            showToast('返回上一页');
        });
        
        // 筛选按钮
        document.getElementById('filterBtn').addEventListener('click', () => {
            // 创建筛选菜单
            const filterMenu = document.createElement('div');
            filterMenu.className = 'position-fixed bottom-0 left-0 right-0 bg-white border-top border-light rounded-top-3 p-4 z-50';
            filterMenu.innerHTML = `
                <div class="text-center mb-4"><strong>筛选条件</strong></div>
                
                <div class="mb-4">
                    <div class="text-sm font-medium mb-2">礼物状态</div>
                    <div class="d-flex gap-2">
                        <button class="flex-1 py-2 border border-light rounded-2 active">全部状态</button>
                        <button class="flex-1 py-2 border border-light rounded-2">仅显示许愿中</button>
                        <button class="flex-1 py-2 border border-light rounded-2">仅显示已收到</button>
                    </div>
                </div>
                
                <div class="mb-4">
                    <div class="text-sm font-medium mb-2">是否有图</div>
                    <div class="d-flex gap-2">
                        <button class="flex-1 py-2 border border-light rounded-2 active">全部</button>
                        <button class="flex-1 py-2 border border-light rounded-2">仅显示有图</button>
                        <button class="flex-1 py-2 border border-light rounded-2">仅显示无图</button>
                    </div>
                </div>
                
                <div class="filter-actions d-flex gap-3 mt-5">
                    <button class="flex-1 py-3 border border-light rounded-2" id="resetFilter">重置</button>
                    <button class="flex-1 py-3 bg-primary text-white rounded-2" id="confirmFilter">确认筛选</button>
                </div>
            `;
            
            document.body.appendChild(filterMenu);
            
            // 筛选选项点击效果
            filterMenu.querySelectorAll('button:not(#resetFilter):not(#confirmFilter)').forEach(btn => {
                btn.addEventListener('click', function() {
                    // 移除同组其他按钮的active类
                    const siblings = Array.from(this.parentElement.children);
                    siblings.forEach(sib => sib.classList.remove('active', 'border-primary', 'bg-primary/5'));
                    
                    // 添加active类
                    this.classList.add('active', 'border-primary', 'bg-primary/5');
                });
            });
            
            // 重置筛选
            document.getElementById('resetFilter').addEventListener('click', () => {
                document.body.removeChild(filterMenu);
                showToast('已重置筛选条件');
            });
            
            // 确认筛选
            document.getElementById('confirmFilter').addEventListener('click', () => {
                document.body.removeChild(filterMenu);
                showToast('筛选条件已应用');
                
                // 模拟加载状态
                const giftList = document.getElementById('giftList');
                const originalContent = giftList.innerHTML;
                giftList.innerHTML = `
                    <div class="d-flex justify-content-center p-5">
                        <div class="spinner-border text-primary" role="status">
                            <span class="visually-hidden">Loading...</span>
                        </div>
                    </div>
                `;
                
                // 模拟加载延迟
                setTimeout(() => {
                    giftList.innerHTML = originalContent;
                    bindGiftEvents();
                }, 800);
            });
        });
        
        // 分类标签切换
        const categoryTabs = document.querySelectorAll('.category-tab');
        categoryTabs.forEach(tab => {
            tab.addEventListener('click', () => {
                // 移除所有标签的active类
                categoryTabs.forEach(t => t.classList.remove('active'));
                // 给当前点击的标签添加active类
                tab.classList.add('active');
                
                showToast(`已切换到${tab.textContent}`);
                
                // 模拟加载状态
                const giftList = document.getElementById('giftList');
                const originalContent = giftList.innerHTML;
                giftList.innerHTML = `
                    <div class="d-flex justify-content-center p-5">
                        <div class="spinner-border text-primary" role="status">
                            <span class="visually-hidden">Loading...</span>
                        </div>
                    </div>
                `;
                
                // 模拟加载延迟
                setTimeout(() => {
                    giftList.innerHTML = originalContent;
                    bindGiftEvents();
                }, 800);
            });
        });
        
        // 排序和价格筛选变化
        document.getElementById('sortSelect').addEventListener('change', function() {
            const sortText = this.options[this.selectedIndex].text;
            showToast(`已按${sortText}排序`);
            
            // 模拟加载状态
            const giftList = document.getElementById('giftList');
            const originalContent = giftList.innerHTML;
            giftList.innerHTML = `
                <div class="d-flex justify-content-center p-5">
                    <div class="spinner-border text-primary" role="status">
                        <span class="visually-hidden">Loading...</span>
                    </div>
                </div>
            `;
            
            // 模拟加载延迟
            setTimeout(() => {
                giftList.innerHTML = originalContent;
                bindGiftEvents();
            }, 800);
        });
        
        document.getElementById('priceSelect').addEventListener('change', function() {
            const priceText = this.options[this.selectedIndex].text;
            showToast(`已筛选${priceText}的礼物`);
            
            // 模拟加载状态
            const giftList = document.getElementById('giftList');
            const originalContent = giftList.innerHTML;
            giftList.innerHTML = `
                <div class="d-flex justify-content-center p-5">
                    <div class="spinner-border text-primary" role="status">
                        <span class="visually-hidden">Loading...</span>
                    </div>
                </div>
            `;
            
            // 模拟加载延迟
            setTimeout(() => {
                giftList.innerHTML = originalContent;
                bindGiftEvents();
            }, 800);
        });
        
        // 搜索功能
        document.querySelector('.search-input').addEventListener('keypress', function(e) {
            if (e.key === 'Enter' && this.value.trim() !== '') {
                showToast(`搜索礼物: ${this.value.trim()}`);
                
                // 模拟加载状态
                const giftList = document.getElementById('giftList');
                const originalContent = giftList.innerHTML;
                giftList.innerHTML = `
                    <div class="d-flex justify-content-center p-5">
                        <div class="spinner-border text-primary" role="status">
                            <span class="visually-hidden">Loading...</span>
                        </div>
                    </div>
                `;
                
                // 模拟加载延迟
                setTimeout(() => {
                    giftList.innerHTML = originalContent;
                    bindGiftEvents();
                }, 800);
            }
        });
        
        // 绑定礼物卡片事件
        function bindGiftEvents() {
            // 点赞按钮
            document.querySelectorAll('.like-btn:not([data-bound])').forEach(btn => {
                btn.setAttribute('data-bound', 'true');
                btn.addEventListener('click', function() {
                    const icon = this.querySelector('i');
                    const countElem = this.querySelector('.action-count');
                    let count = parseInt(countElem.textContent);
                    
                    if (icon.classList.contains('far')) {
                        // 点赞
                        icon.classList.remove('far');
                        icon.classList.add('fas');
                        this.classList.add('active');
                        countElem.textContent = count + 1;
                        showToast('点赞成功');
                    } else {
                        // 取消点赞
                        icon.classList.remove('fas');
                        icon.classList.add('far');
                        this.classList.remove('active');
                        countElem.textContent = count - 1;
                        showToast('已取消点赞');
                    }
                });
            });
            
            // 评论按钮
            document.querySelectorAll('.comment-btn:not([data-bound])').forEach(btn => {
                btn.setAttribute('data-bound', 'true');
                btn.addEventListener('click', function() {
                    const giftTitle = this.closest('.gift-card').querySelector('.gift-title').textContent;
                    showToast(`查看 "${giftTitle}" 的评论`);
                });
            });
            
            // 分享按钮
            document.querySelectorAll('.share-btn:not([data-bound])').forEach(btn => {
                btn.setAttribute('data-bound', 'true');
                btn.addEventListener('click', function() {
                    showToast('分享成功');
                });
            });
            
            // 收藏按钮
            document.querySelectorAll('.save-btn:not([data-bound])').forEach(btn => {
                btn.setAttribute('data-bound', 'true');
                btn.addEventListener('click', function() {
                    const icon = this.querySelector('i');
                    
                    if (icon.classList.contains('far')) {
                        // 收藏
                        icon.classList.remove('far');
                        icon.classList.add('fas');
                        this.classList.add('active');
                        showToast('已收藏');
                    } else {
                        // 取消收藏
                        icon.classList.remove('fas');
                        icon.classList.add('far');
                        this.classList.remove('active');
                        showToast('已取消收藏');
                    }
                });
            });
            
            // 图片点击预览
            document.querySelectorAll('.media-item img, .single-media img').forEach(img => {
                img.addEventListener('click', function() {
                    showToast('图片预览功能');
                });
            });
            
            // 卡片点击进入详情
            document.querySelectorAll('.gift-card:not([data-bound])').forEach(card => {
                card.setAttribute('data-bound', 'true');
                // 阻止卡片内按钮事件冒泡
                card.querySelectorAll('button').forEach(btn => {
                    btn.addEventListener('click', function(e) {
                        e.stopPropagation();
                    });
                });
                
                card.addEventListener('click', function() {
                    const giftTitle = this.querySelector('.gift-title').textContent;
                    showToast(`查看 "${giftTitle}" 的详情`);
                });
            });
        }
        
        // 加载更多
        document.getElementById('loadMore').addEventListener('click', function() {
            const btn = this;
            const originalText = btn.innerHTML;
            btn.innerHTML = '<i class="fas fa-spinner fa-spin"></i><span>加载中...</span>';
            btn.disabled = true;
            
            // 模拟加载延迟
            setTimeout(() => {
                btn.innerHTML = originalText;
                btn.disabled = false;
                showToast('已加载更多礼物愿望');
                
                // 复制第一个礼物卡片并修改内容
                const giftList = document.getElementById('giftList');
                const firstCard = giftList.querySelector('.gift-card:first-of-type');
                
                if (firstCard) {
                    const clone = firstCard.cloneNode(true);
                    // 修改一些内容以示区别
                    const randomId = Math.floor(Math.random() * 200) + 300;
                    clone.querySelector('.gift-avatar').src = `https://picsum.photos/id/${randomId}/100/100`;
                    
                    // 随机更改时间
                    const times = ['1小时前', '昨天', '3天前', '1周前'];
                    clone.querySelector('.gift-time').textContent = times[Math.floor(Math.random() * times.length)];
                    
                    // 插入到加载更多按钮前
                    giftList.insertBefore(clone, btn);
                    
                    // 重新绑定事件
                    bindGiftEvents();
                }
            }, 1500);
        });
        
        // 添加礼物愿望按钮
        document.getElementById('addGiftBtn').addEventListener('click', () => {
            showToast('打开新建礼物愿望页面');
        });
        
        // 页面加载完成后初始化
        window.addEventListener('DOMContentLoaded', () => {
            bindGiftEvents();
        });
    </script>
</body>
</html>

